import React, { memo, useState } from 'react'
import { getImageUrl } from './util/getImageUrl'
import { Select } from 'antd'

const App = memo(() => {
  const [pictureSrc, setpictureSrc] = useState("alarm");
  const handleChange = (value) => {
    setpictureSrc(value = '图2' ? 'newAlarm' : 'alarm');
    console.log(value);
  }
  return (
    <div style={{ width: '200px', height: '200px' }}>
      <Select
        defaultValue="图1"
        style={{ width: 120 }}
        onChange={handleChange}
        options={[
          { value: '图1', label: '图1' },
          { value: '图2', label: '图2' },
        ]}
      />
      <img src={getImageUrl(pictureSrc)} alt="" />
    </div>
  )
})

export default App